<?php
class PostMessage{
	public static function addMessage($message){
		global $user;
		$ip=$_SERVER["REMOTE_ADDR"];
		$id = mysql_real_escape_string(htmlspecialchars($user->id));
	    $message = mysql_real_escape_string(htmlspecialchars($message));
	 
	    mysql_query("INSERT INTO searchserv_message(date,user,message,ip) 
	      				VALUES(".time().",'$id','$message','$ip')");
	}
	public static function getNbMessage(){
		return mysql_num_rows(mysql_query("SELECT id FROM ".DATABASE_TABLE_MESSAGE));
	}
}
?>